<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/page/inc/taglib.jsp"%>
<div class="pageContent">
	<form method="post" action="${pageContext.request.contextPath}${requestScope.record ==null ?'/shop/shop/insert' :'/shop/shop/update' }" class="pageForm required-validate" onsubmit="return validateCallback(this, dialogAjaxDone);">
		<div class="pageFormContent" layoutH="56">
			<!-- 关闭窗口 -->
			<input type="hidden" name="callbackType" value="closeCurrent" />
			<!-- 隐藏表单 -->
			<c:if test="${requestScope.record !=null}">
				<input type="hidden" name="shopId" value="${requestScope.record.shopId}" />
			</c:if>
			<p class="nowrap">
				<label>店铺名称</label> <input name="shopName" class="required" maxlength="50" type="text" value="${requestScope.record.shopName}" placeholder="请输入店铺名称" />
			</p>
			<input name="shopNum" type="hidden" value="${requestScope.record.shopNum}" />
			<p class="nowrap">
				<label>联系人</label> <input name="contacts" class="required" maxlength="50" type="text" value="${requestScope.record.contacts}" placeholder="请输入联系人" />
			</p>
			<p class="nowrap">
				<label>电话号码</label> <input name="contactNumber" class="required phone" maxlength="11" type="text" value="${requestScope.record.contactNumber}" placeholder="请输入电话号码" />
			</p>
			<input name="mobilePhone" type="hidden" value="${requestScope.record.mobilePhone}" /> 
			<input name="operatingPwd" type="hidden" value="${requestScope.record.operatingPwd}" />
			<p class="nowrap">
				<label>跟进人</label><select name="maid" class="combox required">
						<option value="">请选择</option>
					<c:forEach items="${requestScope.employeeslist}" var="ems">
						<option value="${ems.employeeId}" ${ems.employeeId == requestScope.record.maid ? "selected":""}>${ems.employeeName}</option>
					</c:forEach>
				</select>
			</p>
			<p class="nowrap" style="width: 585px;">
				<label>地址（省&市/区）</label> <input type="hidden" name="areaName" value="${requestScope.record.areaName}" /> <select class="combox required" name="areaCode" id="combox_province" ref="combox_city" refUrl="${pageContext.request.contextPath}/system/areas/getCityByProvince?id={value}" default-value="110000">
					<c:if test="${requestScope.province==null}">
						<option value="all">请选择省份</option>
					</c:if>
					<c:forEach items="${requestScope.provinces}" var="item">
						<option value="${item.id}" ${item.id==requestScope.province?"selected":""}>${item.name}</option>
					</c:forEach>
				</select> <select class="combox required" name="areaCode" id="combox_city" ref="combox_region" refUrl="${pageContext.request.contextPath}/system/areas/getCountyByAreas?id={value}" default-value="110100">
					<c:if test="${requestScope.city==null}">
						<option value="all">请选择城市</option>
					</c:if>
					<c:forEach items="${requestScope.citys}" var="item">
						<option value="${item.id}" ${item.id==requestScope.city?"selected":""}>${item.name}</option>
					</c:forEach>
				</select> <select class="combox required" name="areaCode" id="combox_region" default-value="110100">
					<c:if test="${requestScope.county==null}">
						<option value="all">请选择市区</option>
					</c:if>
					<c:forEach items="${requestScope.countys}" var="item">
						<option value="${item.id}" ${item.id==requestScope.county?"selected":""}>${item.name}</option>
					</c:forEach>
				</select>
			</p>
			<p class="nowrap">
				<label>详细地址</label>
				<textarea rows="4" cols="25" name="address" class="required" maxlength="100" placeholder="请输入详细地址">${requestScope.record.address }</textarea>
			</p>
			<input name="addTime" type="hidden" value='<fmt:formatDate pattern="yyyy-MM-dd" value="${requestScope.record.addTime}"/>' /> 
			<input name="shopState" type="hidden" value="${requestScope.record.shopState}" /> 
			<input name="allowAddProduct" type="hidden" value="${requestScope.record.allowAddProduct}" /> 
			<input name="belongs" type="hidden" value="${requestScope.record.belongs}" /> 
			<input name="operator" type="hidden" value="${requestScope.record.operator}" /> 
			<input name="del" type="hidden" value="${requestScope.record.del}" /> 
			<input name="state" type="hidden" value="${requestScope.record.state}" />
		</div>
		<div class="formBar">
			<ul>
				<!--<li><a class="buttonActive" href="javascript:;"><span>保存</span></a></li>-->
				<li><div class="buttonActive">
						<div class="buttonContent">
							<button type="submit">保存</button>
						</div>
					</div></li>
				<li>
					<div class="button">
						<div class="buttonContent">
							<button type="button" class="close">取消</button>
						</div>
					</div>
				</li>
			</ul>
		</div>
	</form>
</div>
<script type="text/javascript">
	$(".combox").change(function() {
		$("ul,li,a").find("[value='all']").remove();
		var province = $("#combox_province").find("option:selected").text();
		var city = $("#combox_city").find("option:selected").text();
		var region = $("#combox_region").find("option:selected").text();
		$("[name='areaName']").val(province + "," + city + "," + region);
	});
</script>